'use strict';

angular.module('snPaas')
.directive('spSteps',['baseUrl',function(baseUrl){
    return {
      restrict:'A',
      priority:1,
      templateUrl :baseUrl.static+'template/directive/spSteps.html',
      replace:false,
      // scope:{
      //    spTabs: '=',
      //    appData: '='
      // },
      // controller:function(){},
      link:function postLink(scope,iElement,iAttrs){
        scope.baseUrl = baseUrl.static;

        scope.stepsConfig = {};
        scope.stepsConfig.now = 1;
        var titleWidth = iElement.find('.step-list').width();
        scope.$watch('steps',function(n,o){
            var l = scope.stepsConfig.l = scope.steps.length;
            scope.stepsConfig.mr = parseInt((titleWidth -70*l)/(l-1));
            console.log(scope.stepsConfig.mr);
        });
        scope.switchTab = function(n){
          if(n !=scope.now){
            scope.now = n;
          }
        };
      }
   }

}]);
